<!--#include file="../inc/Const.asp"-->
<!--#include file="../inc/ConnSiteData.asp"-->
<!--#include file="../inc/Md5.asp"-->
<HTML>
<head>
<title>后台登陆界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=Utf-8">
</head>
<style>
body{background-color: #FBFAF6;}
TD{font-family:宋体; font-size: 12px;}
.form{background:url(../images/input_bg1.gif);color: #727C97; border: 1px #348CE6 solid; FONT-FAMILY: "宋体"; FONT-SIZE: 14pt; font-weight:bold; background-color: #FFFFFF; width:142px;height:25px;}
.form2{background:url(../images/input_bg1.gif);color: #727C97; border: 1px #348CE6 solid; FONT-FAMILY: "宋体"; FONT-SIZE: 14pt; font-weight:bold; background-color: #FFFFFF; width:81px;height:25px;}
.box{font-size: 12px; border: 1px solid #E3DDCA; line-height:: 20px; background: #FFFFFF;}
.fontw{color:#BEB396;font-weight:bold;font-size:12px;font-family:宋体;}
.fontf{color:#E7E8D6;font-weight:bold;font-size:12px;font-family:宋体;height:15px;text-decoration: none;}
</style>
<body>

<br><br><br>
<table width="404" border="0" align="center" cellpadding="0" cellspacing="0">
<form action="index.asp?action=login" method="post" name="AdminLogin" id="AdminLogin" >
  <tr>
    <td height="50">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="231" valign="top" background="../images/admin_bg.jpg"><table width="94%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="38">&nbsp;</td>
      </tr>
      <tr>
        <td height="134"><table border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td height="30" class="fontw">用户名：</td>
            <td><input name="LoginName" class="box" style="width:120px;"></td>
            <td width="74" rowspan="2" align="right"><input type="image" src="../images/admin_Btn_login.jpg" name="submit" value="登陆"></td>
          </tr>
          <tr>
            <td height="30" class="fontw">密　码：</td>
            <td><input name="LoginPassword" type="password" class="box" style="width:120px;"></td>
            </tr>
          <tr>
            <td height="30" class="fontw">验证码：</td>
            <td><input name="VerifyCode" class="box" style="width:50px;">&nbsp;<img id="vcodeImg" src="about:blank" onerror="this.onerror=null;this.src='../inc/VerifyCode.asp?s='+Math.random();" alt="验证码" title="看不清楚?换一张" style="margin-right:8px;cursor:pointer;" onClick="src='../inc/VerifyCode.asp?s='+Math.random()"/></td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="56" align="center"><span class="fontf">拓科（中国）网络科技有限公司　版权所有</span><br>
          <a href="http://Www.Martechina.Com" target="_blank"><span class="fontf">Http://Www.Martech.Com</span></a></td>
      </tr>
    </table></td>
  </tr>
</form>
</table>
<%
if request("action")="login" then
dim LoginName,LoginPassword,AdminName,Password,AdminPurview,Working,UserName,rs,sql,LoginSystem
LoginName=trim(request.form("LoginName"))
LoginPassword=Md5(request.form("LoginPassword"))


set rs = server.createobject("adodb.recordset")
sql="select * from Martech_Admin where AdminName='"&LoginName&"'"
rs.open sql,conn,1,3
if rs.eof then
   response.write "<script language=javascript> alert('管理员名称不正确，请重新输入。');location.replace('index.asp');</script>"
   response.end
else
   AdminName=rs("AdminName")
   Password=rs("Password")
   AdminPurview=rs("AdminPurview")
   Working=rs("Working")
   UserName=rs("UserName")
end if
if LoginPassword<>Password then
   response.write "<script language=javascript> alert('管理员密码不正确，请重新输入。');location.replace('index.asp');</script>"
   response.end
end if 
if cstr(session("GetCode"))<>cstr(request("VerifyCode")) then
   response.write "<script language=javascript> alert('您输入验证码错误，请返回重新登录！');location.replace('index.asp');</script>"
   response.end
end if
if not Working then
   response.write "<script language=javascript> alert('不能登录，此管理员帐号已被锁定。');location.replace('index.asp');</script>"
   response.end
end if 
if LoginName=AdminName and LoginPassword=Password then
   rs("LastLoginTime")=now()
   rs("LastLoginIP")=Request.ServerVariables("Remote_Addr")
   rs.update
   rs.close
   set rs=nothing   
   'cookie验证
   'response.cookies("Martech_com")("adminname")=adminname
   'response.cookies("Martech_com")("UserName")=UserName
   'response.cookies("Martech_com")("AdminPurview")=AdminPurview
   'response.cookies("Martech_com")("LoginSystem")=LoginSystem
   'response.cookies("Martech_com")("ip")=Request.servervariables("REMOTE_ADDR")
   'response.Cookies("Martech_com").Expires=date+1   '天
   'response.Cookies("Martech_com").Expires=DateAdd("h", 1, Now())  '小时
   'response.Cookies("Martech_com").Expires=DateAdd("n",60,now())   '分钟
   'response.Cookies("Martech_com").Expires=dateadd("S",30,now())   '秒 
   'session验证
   session("AdminName")=AdminName
   session("UserName")=UserName
   session("AdminPurview")=AdminPurview
   session("LoginSystem")="Succeed"
   session.timeout=60
   '==================================
   dim LoginIP,LoginTime,LoginSoft
   LoginIP=Request.ServerVariables("Remote_Addr")
   LoginSoft=Request.ServerVariables("Http_USER_AGENT")
   LoginTime=now()
   '====================================
   set rs = server.createobject("adodb.recordset")
   sql="select * from Martech_AdminLog"
   rs.open sql,conn,1,3
   rs.addnew
   rs("AdminName")=AdminName
   rs("UserName")=UserName
   rs("LoginIP")=LoginIP
   rs("LoginSoft")=LoginSoft
   rs("LoginTime")=LoginTime
   rs.update
   rs.close
   set rs=nothing 
   '========================================
   response.redirect "manage.asp"
   response.end
end if
end if
%>
</BODY>
</HTML>
